﻿using GameLogic.Objects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GameLogic
{
    class TankFactory
    {
        private Random random;

        private int createdCount;
        public int CreatedCount
        {
            get
            {
                return createdCount;
            }
            private set
            {
                createdCount = value;
            }
        }

        public TankFactory(Random rand)
        {
            random = rand;
        }

        public Tank[] GetNext(int nowAlive)
        {
            int count = (CreatedCount / 10 + Constants.START_LEVEL) - nowAlive;
            if (count == 0)
            {
                return null;
            }
            CreatedCount += count;
            var result = new Tank[count];
            for (int i = 0; i < count; i++)
            {
                result[i] = new Tank(random);
            }
            return result;
        }
    }
}
